package com.mapper;

import java.sql.Date;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.entity.Prescriptiondetail;

import io.lettuce.core.dynamic.annotation.Param;

@Repository
@Mapper
public interface PrescriptionDetailMapper extends BaseMapper<Prescriptiondetail>{
    @Insert("insert into prescriptiondetail (start_date,end_date) values (#{start_date},#{end_date}) where prescription_id = #{id}")
    void insert(@Param("prescription_id") int id, @Param("start_date") Date start_date, @Param("end_date") Date end_date);

    @Select("SELECT prescription_detail_id FROM prescriptiondetail WHERE prescription_id = #{prescriptionId}")
    Integer selectByPrescriptionId(Integer prescriptionId);
}
